package com.day0928.task;

import com.day0928.abstracts.Dog;

import java.util.ArrayList;
import java.util.Arrays;

public class Task {
    public static void main(String[] args) {
        //设计一个类
        //  保存 多个任意类型的对象
        // 提供增删查的方法
        Student student = new Student("张三");
        Student student1 = new Student("李四");
        Student student2 = new Student("王五");
        Student student3 = new Student("李六");
        Student student4 = new Student("12");
        Student student5 = new Student("34");
        MyArray myArray = new MyArray();
        myArray.add(student);
        myArray.add(student1);
        myArray.add(student2);
        myArray.add(student3);
        myArray.add(student4);
        myArray.add(student5);
        //myArray.remove(1);
        for (int i = 0; i < myArray.getLen(); i++) {
            Object obj = myArray.get(i);
            Student stu = (Student)obj;
            System.out.println(stu.getName());
        }

        ArrayList arrayList = new ArrayList();///保存 多个任意类型的对象
        arrayList.add(student);
        arrayList.add(student1);
        arrayList.add(student2);
        arrayList.add(student3);
        arrayList.add(student4);
        arrayList.add(student5);
        System.out.println(arrayList.size());
        arrayList.remove(student5);
        for (int i = 0; i < arrayList.size(); i++) {
            Object obj = arrayList.get(i);
            Student stu = (Student)obj;
            System.out.println(stu.getName());
        }
    }
}
